use "/Users/saravananthangarajan/Desktop/THESIS FINAL/STATA IMAGES/Reg DATAset.dta"
use "/Users/saravananthangarajan/Desktop/THESIS FINAL/STATA IMAGES/Reg DATAset.dta"
use "/Users/saravananthangarajan/Desktop/THESIS FINAL/STATA IMAGES/Reg DATAset.dta"
use "/Users/saravananthangarajan/Desktop/Reg DATAset.dta"
tab CHILD_STAT
tab CHILD_STAT_new
recode CHILD_STAT_new 1=0 2=1, generate(Child_Health)
tab Child_Health
logistic Child_Health i.AGE
logistic Child_Health i.MAR_STAT_new
logistic Child_Health i.LOC
logistic Child_Health ib2.M_EDU_new
logistic Child_Health ib2.M_EMP_new
logistic Child_Health ib2. ANN_INC
logistic Child_Health ib3. UTI_GOV_HS
logistic Child_Health ib3. HUS_EMP
label define HUS_SUP_CC 1 "Never" 2 "rarely" 3 "often" 4 "always"
label values HUS_SUP_CC HUS_SUP_CC
label define HUS_ATT_CC 1 "Unsupportive" 2 "Neutral" 3 "Somewhat supportive" 4 "Very supportive"
label values HUS_ATT_CC HUS_ATT_CC
label define DEC_MAK 1 "Not at all" 2 "Rarely" 3 "Major" 4 "All"
label values DEC_MAK DEC_MAK
label define HOU_TYP 1 "Temporary" 2 "Apartment" 3 "Independent House"
label values HOU_TYP DEC_MAK
label define VENT 1 "Poor" 2 "Partial" 3 "Good"
label values VENT VENT
label define ROOF 1 "Thatch" 2 "Metal Sheet" 3 "Tile" 4 "Concrete"
label values ROOF ROOF
label define CC_INT 1 "Low" 2 "Moderate" 3 "High"
label values CC_INT CC_INT
label define AC_AVAIL 1 "No" 2 "Yes"
label values AC_AVAIL AC_AVAIL
label define PROX_POLL 1 "< 1 km" 2 "1-5 km" 3 "> 5 km"
label values PROX_POLL PROX_POLL
label define EOA_HOSP 1 "Very difficult" 2 "Difficult" 3 "Fairly easy" 4 "Very easy"
label values EOA_HOSP EOA_HOSP
label define BTA_HOSP 1 "Lack of Health services" 2 "Stigma" 3 "Geographic" 4 "Financial" 5 "No barriers"
label values BTA_HOSP BTA_HOSP
tab KHI_CS_new
tab PHI_CS
gen PHI_CS_new = .
replace PHI_CS = 1 if PHI_CS == 1
replace PHI_CS = 2 if inlist(PHI_CS, 2, 3)
tab PHI_CS_new
drop PHI_CS_new
label define KHI_CS 1 "No" 2 "Yes"
label values KHI_CS_new KHI_CS
tab KHI_CS_new
label define CHILD_Health 0 "Normal" 1 "Disabled"
label values Child_Health CHILD_Health
label define MAR_STAT_new 1 "Married" 2 "Single/ Divorced"
label values MAR_STAT_new MAR_STAT_new
label define AGE 1 "18-24" 2 "25-34" 3 "35-39"
label values AGE AGE
label define LOC 1 "Cauvery Delta" 2 "Northeastern" 3 "Northwestern" 4 "Western" 5 "Southern" 6 "High Rainfall" 7 "High Altitude"
label values LOC LOC
label define M_EDU 2 "Educated" 1 "Uneducated"
label values M_EDU_new M_EDU
label define M_EMP 1 "No" 2 "Yes"
label values M_EMP_new M_EMP
label define COP_MES_1 0 "No" 1 "Avoiding outdoor"
label values COP_MES_1 COP_MES_1
label define COP_MES_2 0 "No" 1 "Staying hydrated and maintaining a proper diet"
label values COP_MES_2 COP_MES_2
label define COP_MES_3  0 "No" 1 "Seeking help from family or community"
label values COP_MES_3 COP_MES_3
label define COP_MES_4 0 "No" 1 "Use of  fans/AC"
label values COP_MES_4 COP_MES_4
label define CAT_PHQ_Score 1 "None-minimal depression" 2 "Mild depression" 3 "Moderate depression" 5 "Severe depression" 4 "Moderately severe"
label values Cat_PHQ_Score CAT_PHQ_Score
label define CAT_PSS_Score 1 "Low Stress" 2 "Moderate Stress" 3 "High Stress" 4 "Very High Stress"
label values Cat_PSS_Score CAT_PSS_Score
label define CAT_CCAS_Score 1 "Minimal Anxiety" 2 "Mild Anxiety" 3 "Moderate Anxiety" 4 "Severe Anxiety"
label values Cat_CCAS_Score CAT_CCAS_Score
logistic Child_Health i.AGE
logistic Child_Health i MAR_STAT_new
logistic CHILD_STAT_new MAR_STAT
tab MAR_STAT_new
logistic CHILD_STAT_new i.MAR_STAT_new
logistic Child_Health i.MAR_STAT_new
vfwv
vfrd
ves
efdve
logistic Child_Health i.AGE
logistic Child_Health i.MAR_STAT_new
logistic Child_Health i.LOC
logistic Child_Health ib2.M_EDU_new
logistic Child_Health ib2. M_EMP_new
logistic Child_Health ib2. ANN_INC
logistic Child_Health ib3. UTI_GOV_HS
logistic Child_Health ib3.HUS_EMP
logistic Child_Health ib4.HUS_SUP_CC
logistic Child_Health ib4.HUS_ATT_CC
logistic Child_Health ib4. DEC_MAK
logistic Child_Health i.CC_INT
logistic Child_Health ib3. HOU_TYP
logistic Child_Health ib3. VENT
logistic Child_Health ib4. ROOF
logistic Child_Health ib2. AC_AVAIL
logistic Child_Health ib2.AC_AVAIL_new
logistic Child_Health  ib3. PROX_POLL
logistic Child_Health ib4. EOA_HOSP
logistic Child_Health ib5.BTA_HOSP
tab BTA_HOSP
logistic Child_Health ib5. BTA_HOSP
logistic Child_Health i. KHI_CS_new
logistic Child_Health ib3. PHI_CS
logistic Child_Health i.Cat_PHQ_Score
logistic Child_Health i.Cat_PSS_Score
logistic Child_Health i.Cat_CCAS_Score
tab BTA_HOSP Child_Health
tab Cat_PHQ_Score Child_Health
tab Child_Health Cat_PSS_Score
tab Child_Health CC_INT
tab Child_Health HUS_SUP_CC
tab Child_Health BTA_HOSP
recode HUS_SUP_CC 4=3 3=2 2=1 1=1, generate(HUS_SUP_CHILD)
recode Cat_PSS_Score 3=2 2=2 1=1, generate(Cat_PSS_COMB)
tab Cat_PSS_COMB
tab HUS_SUP_CHILD
tab phq_total_score
tab Cat_PHQ_Score
recode Cat_PHQ_Score 5=4 4=4 3=3 2=2 1=1, generate(CAT_PHQ_COMB)
tab CAT_PHQ_COMB
label define CAT_PHQ_COMB 1 "minimal" 2 "Mild" 3 "Moderate" 4 "Moderately/Severe"
label values CAT_PHQ_COMB CAT_PHQ_COMB
tab Cat_PSS_COMB
label define CAT_PSS_COMB 1 "Low Stress" 2 "High Stress"
label values Cat_PSS_COMB CAT_PSS_COMB
label define HUS_SUP_CHILD 1 "Never" 2 "Sometimes" 3 "Always"
label values HUS_SUP_CHILD HUS_SUP_CHILD
tab CC_INT
tab CC_INT Child_Health
recode CC_INT  3=3 2=3 1=1, generate(CHILD_CARE_INT)
tab CHILD_CARE_INT
label define CHILD_CARE_INT 3 "High" 1 "Low"
label values CHILD_CARE_INT CHILD_CARE_INT
tab CHILD_CARE_INT
logistic Child_Health i.CHILD_CARE_INT
logistic Child_Health CAT_PHQ_COMB
tab CAT_PHQ_COMB
logistic Child_Health i.CAT_PHQ_COMB
tab CAT_PHQ_COMB Child_Health
recode CAT_PHQ_COMB 4=3 3=3 2=2 1=1, generate(CAT_PHQ_FINAL)
tab CAT_PHQ_FINAL
label define CAT_PHQ_FINAL 2 "Moderate" 1 "Mild" 3 "Severe"
label values CAT_PHQ_FINAL CAT_PHQ_FINAL
tab CAT_PHQ_FINAL
logistic Child_Health CAT_PHQ_FINAL
tab Child_Health CAT_PHQ_FINAL
logistic Child_Health i.CAT_PHQ_FINAL
logistic Child_Health Cat_PSS_COMB
logistic Child_Health i.Cat_PSS_COMB
tab Child_Health Cat_PSS_COMB
tab CHILD_CARE_INT
tab Child_Health
tab Child_Health CHILD_CARE_INT
logistic Child_Health CHILD_CARE_INT
logistic Child_Health i.Cat_CCAS_Score
tab Cat_CCAS_Score
recode Cat_CCAS_Score 4=3 3=3 2=2 1=1, generate(Cat_CCAS_Final)
tab Cat_CCAS_Final
label define Cat_CCAS_Final 1 "Mild" 2 "Moderate" 3 "Severe"
label values Cat_CCAS_Final Cat_CCAS_Final
logistic Child_Health Cat_CCAS_Final
tab Child_Health Cat_CCAS_Final
logistic Child_Health i.Cat_CCAS_Final
logistic Child_Health i.AGE i.MAR_STAT_new ib2.LOC ib2.M_EDU_new ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4.DEC_MAK i.CC_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib3.PROX_POLL i.CAT_PHQ_FINAL i.Cat_PSS_COMB ib3.PHI_CS
tab PHI_CS
. logistic Child_Health i.AGE i.MAR_STAT_new ib2.LOC ib2.M_EDU_new ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4.DEC_M
. logistic Child_Health i.AGE i.MAR_STAT_new ib2.LOC ib2.M_EDU_new ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4.DEC_MAK i.CHILD_CARE_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib3.PROX_POLL i.CAT_PHQ_FINAL i.Cat_PSS_COMB i.PHI_CS
tab MAR_STAT_new
tab Child_Health MAR_STAT_new
logistic Child_Health i.AGE i.MAR_STAT_new ib2.LOC ib2.M_EDU_new ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4. DEC_MAK i.CHILD_CARE_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib3.PROX_POLL i.CAT_PHQ_FINAL i.Cat_CCAS_Final ib2.KHI_CS_new
tab Child_Health CHILD_CARE_INT
logistic Child_Health CHILD_CARE_INT
 logistic Child_Health i.CHILD_CARE_INT
 logistic Child_Health i.AGE i.MAR_STAT_new ib2.LOC ib2.M_EDU_new ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4. DEC_MAK CHILD_CARE_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib3.PROX_POLL i.CAT_PHQ_FINAL i.Cat_CCAS_Final ib2.KHI_CS_new
tab CHILD_CARE_INT Child_Health
 logistic Child_Health i.AGE i.MAR_STAT_new ib2.LOC ib2.M_EDU_new ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4. DEC_MAK CHILD_CARE_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib3.PROX_POLL i.CAT_PHQ_FINAL i.Cat_CCAS_Final ib2. KHI_CS_new i.Cat_PSS_COMB
tab Cat_PSS_COMB Child_Health
logistic Child_Health Cat_PSS_COMB
logistic Child_Health i.Cat_PSS_COMB
reg phq_total_score i.AGE i.MAR_STAT_new i.LOC ib2.M_EDU_new ib2.M_EMP_new ib2. ANN_INC ib3.UTI_GOV_HS ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4.DEC_MAK i.CHILD_STAT_new i CHILD_CARE_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib2.AC_AVAIL_new ib3.PROX_POLL EOA_HOSP ib5 BTA_HOSP i.KHI_CS_new i.Cat_PSS_COMB i.Cat_CCAS_Final
. reg phq_total_score i.AGE i.MAR_STAT_new i.LOC ib2.M_EDU_new ib2.M_EMP_new ib2. ANN_INC ib3.UTI_GOV_HS ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4.DEC_MAK i.CHILD_STAT_new i.CHILD_CARE_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib2.AC_AVAIL_new ib3.PROX_POLL EOA_HOSP ib5 BTA_HOSP i.KHI_CS_new i.Cat_PSS_COMB i.Cat_CCAS_Final
. reg phq_total_score i.AGE i.MAR_STAT_new i.LOC ib2.M_EDU_new ib2.M_EMP_new ib2. ANN_INC ib3.UTI_GOV_HS ib3.HUS_EMP ib3.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4.DEC_MAK i.CHILD_STAT_new i.CHILD_CARE_INT ib3.HOU_TYP ib3.VENT ib4.ROOF ib2.AC_AVAIL_new ib3.PROX_POLL EOA_HOSP ib5. BTA_HOSP i.KHI_CS_new i.Cat_PSS_COMB i.Cat_CCAS_Final
. reg phq_total_score i.AGE i.MAR_STAT_new i.LOC i.M_EDU_new i.M_EMP_new i. ANN_INC i.UTI_GOV_HS i.HUS_EMP i.HUS_SUP_CHILD ib4.HUS_ATT_CC ib4.DEC_MAK i.CHILD_STAT_new i.CHILD_CARE_INT i.HOU_TYP i.VENT i.ROOF i.AC_AVAIL_new i.PROX_POLL EOA_HOSP i. BTA_HOSP i.KHI_CS_new i.Cat_PSS_COMB i.Cat_CCAS_Final
tab HUS_SUP_CHILD
reg phq_total_score i.AGE
reg phq_total_score MAR_STAT_new
reg phq_total_score i.LOC
reg phq_total_score ib2.M_EDU_new
reg phq_total_score ib2.M_EMP_new
reg phq_total_score ib2.ANN_INC
reg phq_total_score ib3.UTI_GOV_HS
reg phq_total_score ib3.HUS_EMP
reg phq_total_score ib3.HUS_SUP_CHILD
reg phq_total_score ib4.HUS_ATT_CC
reg phq_total_score ib4.DEC_MAK
reg phq_total_score Child_Health
reg phq_total_score i.CHILD_STAT_new
reg phq_total_score i.CHILD_CARE_INT
reg phq_total_score ib3.HOU_TYP
reg phq_total_score ib3.VENT
reg phq_total_score ib4.ROOF
reg phq_total_score ib2.AC_AVAIL_new
reg phq_total_score ib3.PROX_POLL
reg phq_total_score EOA_HOSP
reg phq_total_score ib5.BTA_HOSP
reg phq_total_score i.KHI_CS_new
reg phq_total_score i.Cat_PSS_COMB
reg phq_total_score Cat_CCAS_Final
reg phq_total_score PSS_Total
reg phq_total_score CCAS_Total
reg phq_total_score UTI_GOV_HS
tab UTI_GOV_HS
label define UTI_GOV_HS 1 "No" 2 "Sometimes" 3 "Regularly"
reg phq_total_score ib3.UTI_GOV_HS
label values UTI_GOV_HS UTI_GOV_HS
reg phq_total_score ib3. UTI_GOV_HS
reg phq_total_score HUS_EMP
reg phq_total_score HUS_SUP_CHILD
tab HUS_SUP_CHILD
reg phq_total_score HUS_SUP_CHILD
reg phq_total_score ib3.HUS_SUP_CHILD
reg phq_total_score i.HUS_SUP_CC
tab HUS_SUP_CC
reg phq_total_score i.MAR_STAT_new ib3.HUS_EMP ib3.HUS_SUP_CC ib4.HUS_ATT_CC ib4.DEC_MAK i.CHILD_STAT_new ib3.HOU_TYP ib3.VENT ib4.ROOF ib3.PROX_POLL PROX_POLL EOA_HOSP ib5.BTA_HOSP PSS_Total CCAS_Total
histogram phq_total_score, normal
swilk phq_total_score 
reg phq_total_score ib3.PROX_POLL ib2. M_EDU_new i.HUS_SUP_CHILD ib5.BTA_HOSP  i.CHILD_CARE_INT PSS_Total CCAS_Total, vce(robust)
reg phq_total_score ib3.PROX_POLL ib2. M_EDU_new ib4.DEC_MAK ib5.BTA_HOSP  i.Child_Health PSS_Total CCAS_Total, vce(robust)
reg phq_total_score ib3.PROX_POLL ib2.M_EMP_new ib4.HUS_ATT_CC ib5.BTA_HOSP  i.Child_Health PSS_Total CCAS_Total, vce(robust)
reg phq_total_score ib3.PROX_POLL ib2.ANN_INC ib3.HUS_SUP_CHILD ib5.BTA_HOSP  i.Child_Health PSS_Total CCAS_Total, vce(robust)
reg phq_total_score ib3.PROX_POLL ib2.M_EDU_new ib4.HUS_ATT_CC ib5.BTA_HOSP  i.Child_Health PSS_Total CCAS_Total, vce(robust)
reg phq_total_score ib3.PROX_POLL 
reg phq_total_score ib2.M_EDU_new
reg phq_total_score ib4.HUS_ATT_CC
reg phq_total_score ib5.BTA_HOSP
reg phq_total_score i.Child_Health
reg phq_total_score PSS_Total
reg phq_total_score CCAS_Total
reg phq_total_score ib3.PROX_POLL##i.Child_Health ib2.M_EDU_new ib4.HUS_ATT_CC ib5.BTA_HOSP PSS_Total CCAS_Total, vce(robust)
reg phq_total_score ib3.PROX_POLL ib2.M_EDU_new ib4.HUS_ATT_CC ib5.BTA_HOSP PSS_Total CCAS_Total if Child_Health == 1, vce(robust)
reg phq_total_score ib3.PROX_POLL ib2.M_EDU_new ib4.HUS_ATT_CC ib5.BTA_HOSP PSS_Total CCAS_Total if Child_Health == 0, vce(robust)
* Run the multivariable linear regression model
reg phq_total_score ib3.PROX_POLL ib2.M_EDU_new i.HUS_SUP_CHILD ib5.BTA_HOSP i.CHILD_CARE_INT PSS_Total CCAS_Total, vce(robust)
* Generate predicted (fitted) values and residuals
* Generate residual vs. fitted values plot
reg phq_total_score ib3.PROX_POLL ib2.M_EDU_new i.HUS_SUP_CHILD ib5.BTA_HOSP i.CHILD_CARE_INT PSS_Total CCAS_Total, vce(robust)
twoway
twoway (scatter residuals yhat, mcolor(blue))  (lfit residuals yhat, lcolor(black)), yline(0, lpattern(dash)) title("Residual vs. Fitted Values Plot") ytitle("Residuals") xtitle("Fitted Values") legend(off)
* Install medeff if not already installed
* Run mediation with PSS_Total as mediator
ssc describe m
sem (PSS_Total <- Child_Health) (phq_total_score <- PSS_Total Child_Health),  vce(robust) nocapslatent
estat teffects
sem (CHILD_CARE_INT <- Child_Health) (phq_total_score <- CHILD_CARE_INT Child_Health), vce(robust) nocapslatent
estat teffects
tab CHILD_CARE_INT
tab HUS_SUP_CHILD
tab AC_AVAIL_new
tab KHI_CS_new
gen ROOF_recode = .
replace ROOF_recode = 4 if ROOF == 4       
replace ROOF_recode = 3 if inlist(ROOF, 2, 3) 
replace ROOF_recode = 1 if ROOF == 1      
label define roof_lbl 1 "Thatch" 3 "Tile/Metal" 4 "Concrete"
label values ROOF_recode roof_lbl
foreach var in HOU_TYP ROOF_recode VENT PROX_POLL AC_USE {
    egen z_`var' = std(`var')
}
sem (ENV -> z_HOU_TYP z_ROOF_recode z_VENT z_PROX_POLL z_AC_USE), var(ENV@1) method(mlmv)
predict z_env_varfix, latent
reg phq_total_score c.z_env_varfix##i.Child_Health AGE M_EDU_new M_EMP_new ANN_INC MAR_STAT_new HUS_SUP_CHILD HUS_EMP DEC_MAK, robust
sem (PSS_Total <- z_env_varfix) (CHILD_CARE_INT <- z_env_varfix)  (phq_total_score <- z_env_varfix PSS_Total CHILD_CARE_INT),  method(mlmv) standardized nocapslatent
estat teffects
sem (HUS_SUP_CC <- z_env_varfix) (phq_total_score <- z_env_varfix HUS_SUP_CC), method(mlmv) standardized nocapslatent
estat teffects
sem (DEC_MAK <- z_env_varfix) (phq_total_score <- z_env_varfix DEC_MAK), method(mlmv) standardized nocapslatent
estat teffects
sem (EOA_HOSP <- z_env_varfix) (phq_total_score <- z_env_varfix EOA_HOSP), method(mlmv) standardized nocapslatent
estat teffects
reg phq_total_score c.z_env_varfix##i.Child_Health AGE M_EDU_new M_EMP_new ANN_INC MAR_STAT_new HUS_SUP_CHILD HUS_EMP DEC_MAK, robust
margins Child_Health, at(z_env_varfix = (-2(0.5)2)) post
marginsplot, title("Interaction Plot: Environmental Hardship × Child Disability") ytitle("Predicted PHQ-9 Depression Score") xtitle("Environmental Hardship (Standardized Z-Score)") legend(label(1 "Child: No Disability") label(2 "Child: Disability")) recastci(rarea)
graph save "Graph" "/Users/saravananthangarajan/Desktop/Interaction Plots EVN_CHILDHEALTH.gph"
estat gof, stats(all)
sem (ENV -> housing_type roofing ventilation proximity AC_use), var(ENV@1)
predict z_env_varfix, latent
sem (ENV -> z_HOU_TYP z_ROOF_recode z_VENT z_PROX_POLL z_AC_USE), var(ENV@1)
predict z_env_varfix, latent
* Step 1: Build the latent variable using CFA
sem (ENV -> z_HOU_TYP z_ROOF_recode z_VENT z_PROX_POLL z_AC_USE), var(ENV@1)
* Step 2: Assess model fit
estat gof, stats(all)
* Step 3: If fit is acceptable, generate factor scores
